| 12345678910111213141516171819202122232425 |
- // app/api/branches/[branch]/years/route.js
- import { NextResponse } from "next/server";
- import { listYears } from "@/lib/storage";
- export async function GET(request, { params }) {
- const { branch } = params;
- if (!branch) {
- return NextResponse.json(
- { error: "branch Parameter fehlt" },
- { status: 400 }
- );
- }
- try {
- const years = await listYears(branch);
- return NextResponse.json({ branch, years });
- } catch (error) {
- console.error("[api/branches/[branch]/years] Fehler:", error);
- return NextResponse.json(
- { error: "Fehler beim Lesen der Jahre" },
- { status: 500 }
- );
- }
- }
|